<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录日志</title>
    <link rel="stylesheet" type="text/css" href="/static/hplus/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/hplus/css/style.css">
    <link rel="stylesheet" type="text/css" href="/static/layer/skin/layer.css">
    <style type="text/css">
        .form-control {width: 220px;}
        .ttd {width: 250px;text-align: center;}
        .ttb {width: 80px;text-align: center;}
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <form action="{:url('logs')}" method="get">
                        <table style="width: 100%;padding: 0;border: none">
                            <tr>
                                <td colspan="100" class="tab_a">
                                    <a href="javascript:;" data-href="{:url('logs')}" class="btn{if($today)} btn-success{/if}">当天</a>
                                    <a href="javascript:;" data-href="{:url('logs')}?today=0" class="btn{if(!$today)} btn-success{/if}">历史</a>
                                    <input type="hidden" name="today" value="{$today}">
                                </td>
                            </tr>
                            <tr>
                                <td class="ttd">
                                    <select class="form-control" name="user_id">
                                        <option value="">…用户…</option>
                                        {foreach $users as $user}
                                        <option value="{$user.id}" {if($param.user_id===$user.id)}selected="1"{/if}>{$user.username}</option>
                                        {/foreach}
                                    </select>
                                </td>
                                {if(!$today)}
                                <td class="ttd">
                                    <input type="text" id="ctime" name="ctime" value="{$param.ctime}" class="laydate-icon form-control layer-date" placeholder="登录日期" autocomplete="off">
                                </td>
                                {/if}
                                <td class="ttd">
                                    <input name="mobile" class="form-control" value="{$param.mobile}" placeholder="用户手机号" autocomplete="off">
                                </td>
                                <td class="ttd">
                                    <input name="ip" class="form-control" value="{$param.ip}" placeholder="登录IP" autocomplete="off">
                                </td>
                                <td class="ttb"><input type="submit" class="btn btn-sm btn-primary" value="搜索"></td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </form>
                </div>
                <div class="ibox-content">
                    <table id="treeTable"></table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="/static/hplus/js/jquery.min.js?v={php}echo time(){/php}"></script>
<script type="text/javascript" src="/static/layer/layer.js?v={php}echo time(){/php}"></script>
{if(!$today)}
<script type="text/javascript" src="/static/hplus/js/plugins/layer/laydate/laydate.js?v={php}echo time(){/php}"></script>
{/if}
<script type="text/javascript" src="/static/royui/royui.min.js?v={php}echo time(){/php}"></script>
<script>
    $(function () {
        '{if(!$today)}'
        laydate({
            elem: '#ctime',
            event: 'focus'
        })
        '{/if}'
        $('.tab_a a').click(function () {
            location.href = $(this).data('href')
        })
        //let $data = JSON.parse('<?php echo json_encode($list); ?>');
        let r = new royui();
        r.treeTable({
            elem: '#treeTable',
            //data: $data,
            url: '{:url("logs")}',
            method: 'post',
            //is_cache: false,
            count: {$count},
            paging: true,
            pages: {$pages},
            show_pages: 10,
            jump_to: true,
            cols: [
                {
                    field: 'username',
                    title: '账号'
                },
                {
                    field: 'mobile',
                    title: '手机号'
                },
                {
                    field: 'ip',
                    title: '登录IP'
                },
                {
                    field: 'ctime',
                    title: '登录时间',
                    title_style: 'cursor:pointer',
                    is_sort: true
                }
            ]
        })
    });
</script>
</html>
